<!--个性化设置-->
<template>
  <div class="bg bg1">
    
    <VSwitc class="switc" v-if="account"
    v-model="account.openCloseHome" 
    :title="T('显示主页')"
    @change="httpOpenAndCloseHomePage"></VSwitc>
    <div class="line line1"></div>
  </div>
</template>

<script>
//组件
import VSwitc from "@/_public/VSwitc.vue";

import jnavigator from "@/_js/navigator";
import jhttps from "@/_js/https";
import jmodal from "@/_js/modal";
import jconfig from "@/_js/config";

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;
weexFunction.setTitle(T("更多设置"));

export default {

  components: {
    VSwitc,
  },

  
  data() {
    return {
      T:T,
      Config:jconfig,

      opUser:true,
      account:undefined, //用户信息
    };
  },

  created(){
    this.httpUserInfo();
  },

  methods: {

    /********************************** HTTP*/
    //http用户信息
    httpUserInfo() {
      
      var param = {};
      jhttps.postX("userV2/userDetail",param,true,(data) => {
        if (data.status == 200) {
          data = data.data;
          this.account = data.account;
        } else {
          jmodal.toast(data.msg);
        }
      });
    },

    //http开启关闭查看主页
    httpOpenAndCloseHomePage(openCloseHome) {
      
      jmodal.showLoad();
      var param = {'openCloseHome':openCloseHome};
      jhttps.post("followNew/openAndCloseHomePage",param,true,(data) => {
        jmodal.hideLoad();
        if (data.status == 200) {
          this.account.openCloseHome = openCloseHome;
        } else {
          this.account.openCloseHome = !openCloseHome;
          jmodal.toast(data.msg);
        }
      });
    },

    /**************** 点击 */
    //开放个人主页
    opUserClick(opUser) {
    },
  }
};
</script>

<style src="@/_css/style.css" ></style>
<style scoped>
.bg {
  flex: 1;
  padding-left: 40px;
  padding-right: 40px;
}
.switc {
  height:118px;
}
.line{
  height: 1px;
  margin-left: 40px;
}
</style>
